package edu.cibertec.action;

import java.util.ArrayList;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import edu.cibertec.service.FacturaService;
import edu.cibertec.util.ClienteFacturaDTO;

@SuppressWarnings("serial")
@ParentPackage(value="CiberStudio")
public class FacturaAction extends ActionSupport{
	
	public Map<String, Object> session = ActionContext.getContext().getSession();
	
	FacturaService svFactura= new FacturaService();
	private ArrayList<ClienteFacturaDTO> clientefacturas= new ArrayList<ClienteFacturaDTO>();
	private ClienteFacturaDTO clientefactura;
	
	
	@Action(value="/a_gestionFactura",results = {@Result(location = "t_gestionFactura", name = "success", type = "tiles")})
	public String listarCliente(){	
		
		return SUCCESS;
	}
	
	@Action(value = "listarClienteFacturaJSON", results = { @Result(name = "success", type = "json") })
	public String listarClienteExpediente() {
		
		clientefacturas = svFactura.listaClienteFactura();
		for (ClienteFacturaDTO x : clientefacturas) {
			System.out.println(x);
		}
		return SUCCESS;
	}
	
	
	

	public ArrayList<ClienteFacturaDTO> getClientefacturas() {
		return clientefacturas;
	}

	public void setClientefacturas(ArrayList<ClienteFacturaDTO> clientefacturas) {
		this.clientefacturas = clientefacturas;
	}

	public ClienteFacturaDTO getClientefactura() {
		return clientefactura;
	}

	public void setClientefactura(ClienteFacturaDTO clientefactura) {
		this.clientefactura = clientefactura;
	}
	
	
	
}
